package diva.pap;

import static diva.lib.lang.Lang.is;

import diva.android_library.rpc.Request;
import diva.android_library.rpc.Response;
import diva.lib.json.JSONArray;
import diva.lib.net.UrlBuilder;
import diva.pap.model.RequestBase;

public class SellNotificationRequest<SELF_TYPE extends Request<SELF_TYPE>> extends
    RequestBase<SELF_TYPE> {
  private String fromtime;

  public SellNotificationRequest(Response<SELF_TYPE> response) {
    super(null, "sell_notification", response);
  }

  @Override
  public UrlBuilder getUrl() {
    if (is(fromtime)) return super.getUrl().add("fromtime", fromtime);
    return super.getUrl();
  }

  public void setFromTime(String fromtime) {
    this.fromtime = fromtime;
  }

  protected JSONArray getSellsJson() {
    return data.get("sells").asArray();
  }

  protected String getTime() {
    return data.getString("time");
  }
}
